<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<!-- #BeginTemplate "../../../openslp.dwt" -->

<!--
    
    Pristine 1.0
    
    Design copyright Matt Dibb 2006
    www.mdibb.net

    Please feel free to use and modify this template for use on your site.  I dont mind
    if you use it for your personal site or a commercial site, but I do insist that it is
    not sold or given away in some "50,000 Templates!" package or something like that.

-->

    <head profile="http://www.w3.org/2005/10/profile">
        <meta http-equiv="Content-Language" content="en-gb" />
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
        <link rel="stylesheet" type="text/css" href="../../../site.css" />
        <link rel="stylesheet" type="text/css" href="../../../print.css" media="print" />
        <link rel="alternate" type="application/rss+xml" title="OpenSLP&#8230;Recent Activity" href="http://www.sourceforge.net/export/rss2_keepsake.php?group_id=1730" />
        <link rel="alternate" type="application/rss+xml" title="OpenSLP&#8230;News" href="http://www.sourceforge.net/export/rss2_projnews.php?group_id=1730" />
        <link rel="alternate" type="application/rss+xml" title="OpenSLP&#8230;File Releases" href="http://www.sourceforge.net/api/file/index/project-id/1730/mtime/desc/limit/20/rss" />
        <link rel="alternate" type="application/rss+xml" title="OpenSLP&#8230;Reviews" href="http://www.sourceforge.net/projects/openslp/reviews_feed.rss" />
		<link rel="shortcut icon" href="../../../images/openslp_favicon_256color_48px.ico" />
        <!-- #BeginEditable "Page%20Style%20and%20Scripts" -->
	    <!-- #EndEditable -->
        <!-- #BeginEditable "Page%20Title" -->
  <title>OpenSLP Programmers Guide - Syntax</title>
	    <!-- #EndEditable -->
    </head>
    <body>
        <div id="content">
            <div id="header">
            	<a href="http://openslp.org/">
				<img src="../../../images/openslp_logo_web_color_150px.jpg" alt="" /></a>
            </div>
            <div id="body">
                <!-- #BeginEditable "Left%20Navigation%20-%20Context%20Specific" -->

                <!-- #EndEditable -->
                <div id="links">
                    <p><a href="../../../index.html">About</a><br/>
                       what is openslp</p>
                    <p><a href="../../../download.html">Download</a><br/>
                       how to get openslp</p>
                    <p><a href="../../../contribute.html">Contribute</a><br/>
                       how to help out</p>
                    <p><a href="../../../documentation.html">Documentation</a><br/>
                       how to find out more</p>
                    <p><a href="../../../credits.html">Credits</a><br/>
                       who to blame</p>
                    <p><a href="http://sourceforge.net/projects/openslp"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=1730&amp;type=2" alt="Get OpenSLP at SourceForge.net. Fast, secure and Free Open Source software downloads"/></a></p>
                </div>

                <div id="main">
                <!-- #BeginEditable "Page%20Content" -->

<h2>SLP Syntaxes<br />
<span id="breadcrumbs"><a href="index.html">OpenSLP Programmer's Guide</a> &raquo; Miscellaneous Information &raquo; <a href="Syntax.html">SLP Syntaxes</a></span></h2>

<h3><a name="Service Type"></a>SLP Service Type Syntax</h3>

<p>The official definition of <em>Service Type</em> strings can be found in
<a href="../../rfc/rfc2609.txt">RFC 2609</a>, <em>&quot;Service 
Templates and Service Schemes&quot;</em>.&nbsp; If you will be 
working with &quot;well-known&quot; (IANA) service types, you should 
read it. If you are developing applications for proprietary 
services then you will probably be satisfied with the 
following explanation:</p>
					
<blockquote><b>Service-Type = 
	&quot;service:&quot;&lt;abstract-type.naming-authority&gt;&quot;:&quot;&lt;concrete-type&gt;</b></blockquote>
	
<p>The abstract-type is simple (hopefully short) descriptive 
string that describes the over-arching type of service, and 
defines a set of common attributes (and perhaps default 
values) for all service types that fit into this abstract 
classification. The naming-authority is the name (hopefully 
unique) name of the organization that named the service. The 
naming-authority is optional, but if it is omitted then IANA 
is assumed to be the naming authority, and IANA requires 
service-types to be registered (see RFC 2609). The 
concrete-type is also optional. Think of a concrete-type as 
a kind of sub-type of the abstract-type. For programmer, 
this should be easy: An abtract-type is like a C++ abstract 
base class, and may not be instantiated. A concrete-type is 
derived therefrom, and can be instantiated. For example, 
&quot;printer&quot; is an abstract-type (owned by IANA) and 
&quot;printer:lpr&quot; is a concrete type (owned by IANA).</p>
					
<h4>Service Type Examples</h4>

<p>&quot;weather.nasa:wtp&quot;&nbsp; - A (fictitious) weather service type 
owned by NASA that uses WTP protocol</p>

<p>&quot;weather.nasa:swtp&quot; - A (fictitious) weather service type 
owned by NASA that uses SWTP protocol.</p>

<p>&quot;chat.superchat&quot; - A chat service type owned by SuperChat</p>

<p>&quot;printer.samba&quot; - A samba printer service type</p>

<p>&quot;ftp&quot; - An IANA ftp service type</p>

<p>&quot;telnet&quot; - An IANA telnet service type</p>
					
<h4>Comparing Service Types</h4>

<p>Since service types are important in determining the URL's 
that are return by the <tt><a href="SLPFindSrvs.html">
SLPFindSrvs</a></tt> function, you should understand how 
OpenSLP compares services. Suppose that three services were 
registered with <tt><a href="SLPReg.html">SLPReg</a></tt> 
using a <tt>srvtype</tt> of &quot;printer:lpr&quot;, &quot;printer&quot; and 
&quot;printer.acme&quot;.&nbsp; If a client program calls <tt><a href="SLPFindSrvs.html">
SLPFindSrvs</a></tt>
with a <tt>srvtype</tt> of &quot;service:printer&quot; the URL's for 
both &quot;printer:lpr&quot; and &quot;printer&quot; are returned 
(&quot;printer.acme&quot; is not). However, if
<tt><a href="SLPFindSrvs.html">SLPFindSrvs</a></tt>
is called with <tt>srvtype </tt>of &quot;printer:lpr&quot; or 
&quot;printer.acme&quot; then the urls for &quot;printer:lpr&quot; or 
&quot;printer.acme&quot; would be returned. In other words, if a 
concrete type is used, only services with same abstract- and 
concrete-type are returned. If only the abstract-type is 
used then all services of that abstract-type (and naming 
authority) are returned.</p>
					
<h4>A word about naming authorities</h4>

<p>It is our opinion that developers MUST use a naming 
authority if an IANA service template has not been defined 
that fits the type of service that is being supplied by 
their application. If developers use a predefined IANA 
service template they must use it correctly. However, IANA 
also makes it possible to test experimental service types in 
an public environment. In this case, types should begin with 
the &quot;x-&quot; prefix. No IANA registered types will ever start 
with &quot;x-&quot;.</p>
					
<h3><a name="Service Url"></a>SLP Service Url Syntax</h3>

<p>URL strings are passed as parameters to the
<tt><a href="SLPReg.html">SLPReg</a></tt>,
<tt><a href="SLPDereg.html">SLPDeReg</a></tt>,
<tt><a href="SLPDelAttrs.html">SLPDelAttrs</a></tt>,
<tt><a href="SLPFindSrvs.html">SLPFindSrvs</a></tt>,
<tt><a href="SLPParseSrvURL.html">SLPParseSrvURL</a></tt>
functions and returned in the form of results to the <tt><a
href="SLPSrvURLCallback.html">SLPSrvURLCallback</a></tt>
callback function. SLP defines a special type of URL called 
a Service URL that MUST be used when calling OpenSLP API 
functions. If you decide to use Service URLs extensively, 
you should probably read
<a href="../../rfc/rfc2609.txt">RFC 2609</a>, but if you just want to know what 
they look like, the following explanation should be good 
enough:</p>
					
<blockquote><b><tt>SLP Service URL = &quot;service:&quot;&lt;service-type&gt;&quot;://&quot;&lt;addrspec&gt;</tt></b></blockquote>

<p>The <tt>service-type</tt> is a service type as explained 
above. The <tt>addrspec</tt>
portion can be just about anything you want that fits URL 
syntax and can be translated as a network location. The &quot;<tt>service:</tt>&quot; 
and &quot;<tt>://</tt>&quot; strings are required URL syntax.</p>
					
<h4>Service URL Examples</h4>

<p>&quot;service:weather.nasa:wtp://weather.nasa.com:12000&quot;</p>

<p>&quot;service:weather.nasa:swtp://weather.nasa.com:12001&quot;</p>

<p>&quot;service:chat.superchat://chat.superchat.com;auth=ldap&quot;</p>
					
<h4>Do I have to use the SLP Service URL syntax for my urls?</h4>

<p>Yes. With OpenSLP you are required to use Service URL's. API 
functions will return SLP_PARSE_ERROR if you do not. The 
reason that OpenSLP requires Service URL syntax is because 
the SLP API designers do not allow the service-type to be 
passed in as a parameter to the
<a href="SLPDeReg.html">SLPDeReg</a> call. Without the service-type, SLPDeReg does 
not allow the caller to distinguish between services of 
varying types that were registered with the same standard 
URL. In other words, service-types fully qualify the entry 
in the SLP database.</p>
					
<h3><a name="LDAPv3 Filter"></a>LDAPv3 Search Filter Syntax</h3>

<p>An LDAPv3 Search Filter string is passed as a parameter to 
the <a href="SLPFindSrvs.html">SLPFindSrvs</a>
function. If you want the definitive explanation of LDAPv3 
search filters, you can read <a href="../../rfc/rfc2254.txt">
RFC 2254</a>, <em>&quot;String Representation of LDAP Search Filters&quot;</em>.</p>

<p id="breadcrumbs0">Prepared by: <a href="http://www.calderasystems.com">Caldera Systems Inc</a><br />
Maintained by: <a href="http://www.openslp.org/">openslp.org</a></p>

                <!-- #EndEditable -->
                </div>
            </div>

            <div id="footer">
                Copyright &copy; 2011 <a href="http://www.openslp.org/">openslp.org</a>. All Rights Reserved.<br/>
                Design by <a href="http://www.mdibb.net" title="Website of Matt Dibb">Matt Dibb</a>
                2006. <a href="http://jigsaw.w3.org/css-validator/check/referer" title="Validate CSS">CSS</a> 
                <a href="http://validator.w3.org/check/referer" title="Validate XHTML">XHTML</a>
                <br/>Courtesy of <a href="http://www.openwebdesign.org">Open Web Design</a>
                &amp; <a href="http://seo-services.us">seo</a>
            </div>
        </div>
    </body>
<!-- #EndTemplate -->
</html>
